<template>
	<view>
		<view class="messageBox">
			<view class="list" v-for="item in dataSource" :key="item.id" @click="handleItem(item)">
				<view class="print" v-if="item.readStatus == 0"></view>
				<view class="top">
					<image src="../../static/home/message1.png" />
					<view class="time">{{item.createTime}}</view>
				</view>
				<view class="bottom">
					{{item.content}}
				</view>
			</view>
		</view>
		<view class="box" v-if="dataSource.length == 0">
			<u-empty mode="car" :icon="myImg" text="暂无数据">
			</u-empty>
		</view>
	</view>

</template>

<script>
	import myImg from '@/static/home/bg3.png'
	export default {
		data() {
			return {
				myImg: myImg,
				dataSource:[]
			}
		},
		onShow(){
			this.initData()
		},
		methods:{
			initData(){
				uni.$u.http.post(`/manage/api/message/messageList`).then(res => {
					if(res.code == 0){
						this.dataSource = res.data
					}
				})
			},
			handleItem(item){
				uni.$u.http.get(`/manage/api/message/readMsg/${item.id}`).then(res => {
					
				})
				
				uni.navigateTo({
					url: `/pages/home/reportInfo?id=${item.bizId}`
				})
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #F5F6F7;
	}

	.messageBox {
		padding: 32rpx;

		.list {
			border-radius:16rpx;
			padding: 40rpx 32rpx;
			background-color: #fff;
			margin-bottom: 24rpx;
			position: relative;
			
			.print{
				position: absolute;
				left: 156rpx;
				top: 32rpx;
				width: 16rpx;
				height: 16rpx;
				opacity: 1;
				border-radius: 50%;
				background: rgba(232, 80, 67, 1);
			}
			
			.top {
				display: flex;
				justify-content: space-between;
				align-items: center;
				margin-bottom: 24rpx;

				image {
					width: 120rpx;
					height: 44rpx;
				}

				.time {
					font-size: 26rpx;
					font-weight: 400;
					color: rgba(153, 153, 153, 1);
				}
			}

			.bottom {
				font-size: 28rpx;
				line-height: 40rpx;
				font-weight: 400;
				color: rgba(102, 102, 102, 1);
			}
		}
	}

	.box {
		padding-top: 400rpx;
	}
</style>
